﻿/*
 * 文件名：Department.cs
 * 类名：XHCTMS.BLL.Department
 * 创建人：宁娜
 * 创建时间：2013-05-20
 * 
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace XHCTMS.BLL
{
    /// <summary>
    /// 对部门的操作
    /// </summary>
    public class Department
    {
        /// <summary>
        /// 增加部门
        /// </summary>
        /// <param name="dep">Model层Department类的参数</param>
        /// <returns>返回类型int类型 1/成功，0/异常,-1/失败</returns>
        public int Add(XHCTMS.MODEL.Department dep)
        {
            return new XHCTMS.DAL.Department().Add(dep);
        }

        /// <summary>
        /// 得到所有部门
        /// </summary>
        /// <returns>返回DataTable类型,失败返回null</returns>
        public DataTable GetDepartment()
        {
            return new XHCTMS.DAL.Department().GetDepartment();
        }


        public DataTable GetDepartment(string depName)
        {
            return new XHCTMS.DAL.Department().GetDepartment(depName);
        }
        /// <summary>
        /// 根据部门信息得到部门名称及部门描述
        /// </summary>
        /// <param name="depId">部门号</param>
        /// <returns>返回DataTable类型,失败返回null</returns>
        public DataTable GetDepartment(int pageindex,int pagesize,bool dep_flag)
        {
            return new XHCTMS.DAL.Department().GetDepartment(pageindex,pagesize,dep_flag);
        }

        /// <summary>
        /// 根据部门号删除部门信息
        /// </summary>
        /// <param name="depId">部门号</param>
        /// <returns>返回类型int类型 1/成功，0/异常,-1/失败</returns>
        public int Delete(int depId)
        {
            return new XHCTMS.DAL.Department().Delete(depId);
        }

        /// <summary>
        /// 修改部门状态
        /// </summary>
        /// <param name="depId">部门号</param>
        /// <returns></returns>
        public int Update(int depId)
        {
            return new XHCTMS.DAL.Department().Update(depId);
        }

        /// <summary>
        /// 获取部门号
        /// </summary>
        /// <param name="depName">部门名称</param>
        /// <returns></returns>
        public string GetId(string depName)
        {
            return new XHCTMS.DAL.Department().GetId(depName);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dep">Model层Department类的参数</param>
        /// <returns>返回类型int类型 1/成功，0/异常,-1/失败</returns>
        public int Update(XHCTMS.MODEL.Department dep)
        {
            return new XHCTMS.DAL.Department().Update(dep);
        }

        /// <summary>
        /// 获取所有部门名
        /// </summary>
        /// <returns>返回dataTable类型, null/异常</returns>
        public DataTable GetDepName()
        {
            return new DAL.Department().GetDepartment();
        }
    }
}
